package com.mapper;

import com.pojo.Users;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

/**
 * @author lenove
 @@ -24,4 +28,12 @@ public interface UsersMapper {

 Users findUserWithOrders(Integer id);

 @Select("SELECT * FROM tb_user WHERE id = #{id}")
 @Results({@Result(id = true,column = "id",property = "id"),
 @Result(column = "username",property = "username"),
 @Result(column = "address",property = "address"),
 @Result(column = "id",property = "ordersList",
 many = @Many(select =
 "com.mapper.OrdersMapper.selectOrdersByUserId"))})
 Users selectUserById(int id);
 }